using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;

namespace BUS
{
    public class tbChitietdhBUS
    {
        public static void insert(tbChitietdh  ctdonh)
        {
            tbChitietdhDAL  ctdonhDAL = new tbChitietdhDAL ();
            ctdonhDAL.Insert (ctdonh );

        }
        public static void update(tbChitietdh  ctdonh)
        {
            tbChitietdhDAL  ctdonhDAL = new tbChitietdhDAL ();
            ctdonhDAL.Update (ctdonh );

        }
        public static void Delete(int iD)
        {
           tbChitietdhDAL  ctdonhDAL = new tbChitietdhDAL ();
            ctdonhDAL.Delete(iD);
        }
        public static tbChitietdhCollection  Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbChitietdhDAL  ctdhDAL = new tbChitietdhDAL ();
            return ctdhDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }

        public static tbChitietdhCollection  GetALL()
        {
            int total = 0;
           tbChitietdhDAL  ctdhDAL = new tbChitietdhDAL ();
            return ctdhDAL.Get("where 1=1", 0, 0, tbChitietdhColumn .Mactdh .ToString(), "ASC", out total);
        }
        public static tbChitietdh  GetByID(int iD)
        {
            int total = 0;
          tbChitietdhDAL  ctdhDAL = new tbChitietdhDAL ();
          tbChitietdhCollection  ctdhCollection = ctdhDAL.Get("where " +
          tbChitietdhColumn .Mactdh .ToString() + "=" + iD.ToString(),
              0, 0, tbChitietdhColumn .Mactdh .ToString(), "ASC", out total);
            if (ctdhCollection.Count > 0)
                return ctdhCollection[0];
            return null;
        }
        public static int soluongngdamua(tbChitietdh ctdh)
        {
            tbChitietdhDAL ctDAL = new tbChitietdhDAL();
            return ctDAL.soluongngmua(ctdh);
        }
    }
}
